<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class UserEditPostReques extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        //true 开启  false 关闭
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
           //字段规则
           'username' => 'required|min:6|max:50',
           'phone' => 'required|digits_between:11,11|numeric',
           'email' => 'required|email|',
           'status' => 'required',
        ];
    }
    //错误提示信息
    public function messages()
    {
        return [
           //自定义错误信息
           'username.required' => '用户名不能为空',
           'username.min' => '用户名过短',
           'username.max' => '用户名过长',
           'username.unique' => '用户名已存在,请重新填写',
           'phone.required' => '手机号码不能为空',
           'phone.numeric' => '手机号请填写数字',
           'phone.digits_between' => '手机号格式不正确',
           'email.required' => '电子邮件不能为空',
           'email.email' => '电子邮件格式不正确',
           'email.unique' => '电子邮件已存在,请重新填写',
           'status.required' => '状态不能为空',
        ];
    }
}
